<?php
/**
 * Yii view service
 *
 * @author nguyenmanhluu
 * @since Jul 26, 2013 - 3:31:26 PM
 */
?>

<div class="box span12">
    <div class="box-header">
        <h2>
            <i class="icon-envelope"></i>
            <?php echo $service_model->type == Service::TYPE_ROOM ? 'Class' : 'Service' ?>
        </h2>
    </div>
    <div class="box-content">
        <ul class="nav tab-menu nav-tabs">
            <li <?php echo $service_model->type == Service::TYPE_SERVICE ? 'class="active"' : '' ?>>
                <a href="<?php echo Yii::app()->createUrl('service/index') ?>">
                    Service
                </a>
            </li>
            <li <?php echo $service_model->type == Service::TYPE_ROOM ? 'class="active"' : '' ?>>
                <a href="<?php echo Yii::app()->createUrl('service/room') ?>">
                    Class
                </a>
            </li>
        </ul>
        <div class="row-fluid">
            <div class="pull-left">
                <?php
                echo $this->renderPartial('//service/_filter');
                ?>
            </div>
            <div class="clearfix"></div>
            <?php if (Yii::app()->user->hasFlash('form_success')): ?>
                <div class="pull-left">
                    <div class="alert alert-success">
                        <button type="button" class="close" data-dismiss="alert">×</button>
                        <strong>All done!</strong>
                        <?php echo Yii::app()->user->getFlash('form_success'); ?>
                    </div>
                </div>
            <?php elseif (Yii::app()->user->hasFlash('form_error')): ?>
                <div class="pull-left">
                    <div class="alert alert-error">
                        <button type="button" class="close" data-dismiss="alert">×</button>
                        <strong>Oh snap!</strong> 
                        <?php echo Yii::app()->user->getFlash('form_error'); ?>
                    </div>
                </div>
            <?php endif; ?>
            <div class="pull-right">
                <p>
                    <a href="<?php
                    echo Yii::app()->createUrl('service/create', array(
                        't' => $service_model->type));
                    ?>" class="btn btn-primary" >
                        <i class="icon-plus"></i> Add <?php echo $service_model->type == Service::TYPE_ROOM ? 'Class' : 'Service' ?>
                    </a>
                </p>
            </div>
        </div>
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane active">
                <?php
                $this->renderPartial('_service_tab', array(
                    'service_model' => $service_model,
                    'services'      => $services
                ));
                ?>
            </div>            
        </div>
        <div class="pagination pagination-centered">
            <?php
            $this->widget('application.widgets.MyLinkPager', array(
                'pages'                => $pages,
                'header'               => '',
                'maxButtonCount'       => 5,
                'nextPageLabel'        => '&raquo;',
                'firstPageLabel'       => '←',
                'lastPageLabel'        => '→',
                'prevPageLabel'        => '&laquo;',
                'selectedPageCssClass' => 'active',
            ))
            ?>
        </div>
    </div>
</div><!--/span-->